3.1066 \(\int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx\)

Optimal. Leaf size=80 \[ -\frac{a^2 (c-i d) \tan (e+f x)}{f}-\frac{2 a^2 (d+i c) \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)+\frac{d (a+i a \tan (e+f x))^2}{2 f} \]

[Out]

2*a^2*(c - I*d)*x - (2*a^2*(I*c + d)*Log[Cos[e + f*x]])/f - (a^2*(c - I*d)*Tan[e + f*x])/f + (d*(a + I*a*Tan[e
 + f*x])^2)/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0682502, antiderivative size = 80, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.115, Rules used = {3527, 3477, 3475} \[ -\frac{a^2 (c-i d) \tan (e+f x)}{f}-\frac{2 a^2 (d+i c) \log (\cos (e+f x))}{f}+2 a^2 x (c-i d)+\frac{d (a+i a \tan (e+f x))^2}{2 f} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x]),x]

[Out]

2*a^2*(c - I*d)*x - (2*a^2*(I*c + d)*Log[Cos[e + f*x]])/f - (a^2*(c - I*d)*Tan[e + f*x])/f + (d*(a + I*a*Tan[e
 + f*x])^2)/(2*f)

Rule 3527

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d*
(a + b*Tan[e + f*x])^m)/(f*m), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x))^2 (c+d \tan (e+f x)) \, dx &=\frac{d (a+i a \tan (e+f x))^2}{2 f}-(-c+i d) \int (a+i a \tan (e+f x))^2 \, dx\\ &=2 a^2 (c-i d) x-\frac{a^2 (c-i d) \tan (e+f x)}{f}+\frac{d (a+i a \tan (e+f x))^2}{2 f}+\left (2 a^2 (i c+d)\right ) \int \tan (e+f x) \, dx\\ &=2 a^2 (c-i d) x-\frac{2 a^2 (i c+d) \log (\cos (e+f x))}{f}-\frac{a^2 (c-i d) \tan (e+f x)}{f}+\frac{d (a+i a \tan (e+f x))^2}{2 f}\\ \end{align*}

Mathematica [B]  time = 2.39605, size = 263, normalized size = 3.29 \[ \frac{a^2 \sec (e) \sec ^2(e+f x) (\cos (2 f x)+i \sin (2 f x)) \left (-8 (c-i d) \cos (e) \cos ^2(e+f x) \tan ^{-1}(\tan (3 e+f x))-i \left ((d+i c) \cos (e+2 f x) \left (4 f x-i \log \left (\cos ^2(e+f x)\right )\right )+2 \cos (e) \left ((c-i d) \log \left (\cos ^2(e+f x)\right )+4 i c f x+4 d f x-i d\right )-2 i c \sin (e+2 f x)+4 i c f x \cos (3 e+2 f x)+c \cos (3 e+2 f x) \log \left (\cos ^2(e+f x)\right )+2 i c \sin (e)-4 d \sin (e+2 f x)+4 d f x \cos (3 e+2 f x)-i d \cos (3 e+2 f x) \log \left (\cos ^2(e+f x)\right )+4 d \sin (e)\right )\right )}{4 f (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x]),x]

[Out]

(a^2*Sec[e]*Sec[e + f*x]^2*(Cos[2*f*x] + I*Sin[2*f*x])*(-8*(c - I*d)*ArcTan[Tan[3*e + f*x]]*Cos[e]*Cos[e + f*x
]^2 - I*((4*I)*c*f*x*Cos[3*e + 2*f*x] + 4*d*f*x*Cos[3*e + 2*f*x] + (I*c + d)*Cos[e + 2*f*x]*(4*f*x - I*Log[Cos
[e + f*x]^2]) + c*Cos[3*e + 2*f*x]*Log[Cos[e + f*x]^2] - I*d*Cos[3*e + 2*f*x]*Log[Cos[e + f*x]^2] + 2*Cos[e]*(
(-I)*d + (4*I)*c*f*x + 4*d*f*x + (c - I*d)*Log[Cos[e + f*x]^2]) + (2*I)*c*Sin[e] + 4*d*Sin[e] - (2*I)*c*Sin[e
+ 2*f*x] - 4*d*Sin[e + 2*f*x])))/(4*f*(Cos[f*x] + I*Sin[f*x])^2)

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 123, normalized size = 1.5 \begin{align*} -{\frac{{a}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{2}d}{2\,f}}-{\frac{{a}^{2}c\tan \left ( fx+e \right ) }{f}}+{\frac{2\,i{a}^{2}d\tan \left ( fx+e \right ) }{f}}+{\frac{i{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) c}{f}}+{\frac{{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) d}{f}}-{\frac{2\,i{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ) d}{f}}+2\,{\frac{{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e)),x)

[Out]

-1/2/f*a^2*tan(f*x+e)^2*d-a^2*c*tan(f*x+e)/f+2*I/f*a^2*d*tan(f*x+e)+I/f*a^2*ln(1+tan(f*x+e)^2)*c+1/f*a^2*ln(1+
tan(f*x+e)^2)*d-2*I/f*a^2*arctan(tan(f*x+e))*d+2/f*a^2*arctan(tan(f*x+e))*c

________________________________________________________________________________________

Maxima [A]  time = 1.47441, size = 112, normalized size = 1.4 \begin{align*} -\frac{a^{2} d \tan \left (f x + e\right )^{2} - 4 \,{\left (a^{2} c - i \, a^{2} d\right )}{\left (f x + e\right )} - 2 \,{\left (i \, a^{2} c + a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \,{\left (a^{2} c - 2 i \, a^{2} d\right )} \tan \left (f x + e\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/2*(a^2*d*tan(f*x + e)^2 - 4*(a^2*c - I*a^2*d)*(f*x + e) - 2*(I*a^2*c + a^2*d)*log(tan(f*x + e)^2 + 1) + 2*(
a^2*c - 2*I*a^2*d)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.62135, size = 339, normalized size = 4.24 \begin{align*} -\frac{2 \,{\left (i \, a^{2} c + 2 \, a^{2} d +{\left (i \, a^{2} c + 3 \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (i \, a^{2} c + a^{2} d +{\left (i \, a^{2} c + a^{2} d\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \,{\left (i \, a^{2} c + a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

-2*(I*a^2*c + 2*a^2*d + (I*a^2*c + 3*a^2*d)*e^(2*I*f*x + 2*I*e) + (I*a^2*c + a^2*d + (I*a^2*c + a^2*d)*e^(4*I*
f*x + 4*I*e) + 2*(I*a^2*c + a^2*d)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(4*I*f*x + 4*I*e) +
 2*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [A]  time = 2.65736, size = 121, normalized size = 1.51 \begin{align*} - \frac{2 a^{2} \left (i c + d\right ) \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac{- \frac{\left (2 i a^{2} c + 4 a^{2} d\right ) e^{- 4 i e}}{f} - \frac{\left (2 i a^{2} c + 6 a^{2} d\right ) e^{- 2 i e} e^{2 i f x}}{f}}{e^{4 i f x} + 2 e^{- 2 i e} e^{2 i f x} + e^{- 4 i e}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(c+d*tan(f*x+e)),x)

[Out]

-2*a**2*(I*c + d)*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-(2*I*a**2*c + 4*a**2*d)*exp(-4*I*e)/f - (2*I*a**2*c +
6*a**2*d)*exp(-2*I*e)*exp(2*I*f*x)/f)/(exp(4*I*f*x) + 2*exp(-2*I*e)*exp(2*I*f*x) + exp(-4*I*e))

________________________________________________________________________________________

Giac [B]  time = 1.46287, size = 309, normalized size = 3.86 \begin{align*} \frac{-2 i \, a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 \, a^{2} d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 4 i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 4 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 i \, a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} - 6 \, a^{2} d e^{\left (2 i \, f x + 2 i \, e\right )} - 2 i \, a^{2} c \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 \, a^{2} d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 i \, a^{2} c - 4 \, a^{2} d}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

(-2*I*a^2*c*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 2*a^2*d*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*
I*e) + 1) - 4*I*a^2*c*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 4*a^2*d*e^(2*I*f*x + 2*I*e)*log(e^(2*
I*f*x + 2*I*e) + 1) - 2*I*a^2*c*e^(2*I*f*x + 2*I*e) - 6*a^2*d*e^(2*I*f*x + 2*I*e) - 2*I*a^2*c*log(e^(2*I*f*x +
 2*I*e) + 1) - 2*a^2*d*log(e^(2*I*f*x + 2*I*e) + 1) - 2*I*a^2*c - 4*a^2*d)/(f*e^(4*I*f*x + 4*I*e) + 2*f*e^(2*I
*f*x + 2*I*e) + f)